/*
 * @Description: 文件下载
 * @Date: 2019-09-12 16:58:08
 * @LastEditTime: 2019-10-29 19:25:17
 * @LastEditors: 黎志恒
 */
import Axios from "axios";


const downFile = async function (fileId) {
    let userId = this.$store.state.user.userInfo.uid;
    let tokenRes = await this.api.getUploadFileToken({
        user_id: userId
    });
    let token = tokenRes.data.file_token;
    if (!(tokenRes && tokenRes.data)) {
        this.$toast.show({
            text: "请稍后重试"
        })
        return false
    }
    let res = await Axios.get(
         fileServeUrl + "/obs/api/file/download_file?white_sword=" + token + "&fileId=" + fileId
    )
    window.open(res.data);
}




export default downFile